package com.his.controller;

import com.his.bean.*;
import com.his.service.*;
import com.his.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class GGMController {
    @Autowired
    DzmHisMedicinesService dzmHisMedicinesService;

    @Autowired
    DzmHisSupplierService dzmHisSupplierService;

    @Autowired
    DzmHisPurchaseService dzmHisPurchaseService;

    @Autowired
    DzmHisBatchesOfInventoryService dzmHisBatchesOfInventoryService;

    @Autowired
    DzmHisInventoryService dzmHisInventoryService;


    //    drug  药品信息维护
    @RequestMapping("/DzmHisMember_list")
    @ResponseBody
    public ResponseResult DzmHisMember_list(DzmHisMedicines dzmHisMedicines) {
        System.out.println("这是条件+》》》》》：：" + dzmHisMedicines);
        List<DzmHisMedicines> list = dzmHisMedicinesService.DzmHisMember_list(dzmHisMedicines);
        System.out.println(list);
        return new ResponseResult(200, "ok", list);
    }

    @GetMapping("/DzmHisMember_listQuery")
    public ResponseResult DzmHisMember_listQuery(DzmHisMedicines dzmHisMedicines) {
        System.out.println("这是条件：" + dzmHisMedicines);
        return new ResponseResult(200, "ok", dzmHisMedicinesService.DzmHisMember_listQuery(dzmHisMedicines));
    }

    @RequestMapping("/DzmHisMember_insert")
    @ResponseBody
    public ResponseResult DzmHisMember_insert(Integer medicinesId) {
        System.out.println("导入药品id》》》》：" + medicinesId);
        dzmHisMedicinesService.DzmHisMember_insert(medicinesId);
        return new ResponseResult(200, "ok");
    }

    @RequestMapping("/DzmHisMember_delete")
    @ResponseBody
    public ResponseResult DzmHisMember_delete(Integer medicinesId) {
        System.out.println("删除药品id》》》》：" + medicinesId);
        dzmHisMedicinesService.DzmHisMember_delete(medicinesId);
        return new ResponseResult(200, "ok");
    }


    // supplier 供应商维护
    @RequestMapping("/DzmHisSupplier_list")
    @ResponseBody
    public ResponseResult DzmHisSupplier_list() {
        System.out.println("供应商维护维护列表↓↓↓↓↓↓↓");
        List<DzmHisSupplier> list = dzmHisSupplierService.DzmHisSupplier_list();
        System.out.println(list);
        return new ResponseResult(200, "ok", list);
    }

    @RequestMapping("/DzmHisSupplier_delete")
    @ResponseBody
    public ResponseResult DzmHisSupplier_delete(Long sid) {
        System.out.println("数据删除++sid>>>>>>>>>" + sid);

        dzmHisSupplierService.DzmHisSupplier_delete(sid);
        return new ResponseResult(200, "ok");
    }


    @RequestMapping("/DzmHisSupplier_insert")
    @ResponseBody
    public ResponseResult DzmHisSupplier_insert(DzmHisSupplier dzmHisSupplier) {
        System.out.println("数据添加+++dzmHisSupplier>>>>>>>>>" + dzmHisSupplier);
        int insert = dzmHisSupplierService.DzmHisSupplier_insert(dzmHisSupplier);
        return new ResponseResult(200, "ok", insert);
    }


    @RequestMapping("/DzmHisSupplier_update")
    @ResponseBody
    public ResponseResult DzmHisSupplier_update(DzmHisSupplier dzmHisSupplier) {
        System.out.println("数据修改+++dzmHisSupplier>>>>>>>>>" + dzmHisSupplier);
        int update = dzmHisSupplierService.DzmHisSupplier_update(dzmHisSupplier);
        return new ResponseResult(200, "ok", update);
    }

    @RequestMapping("/DzmHisSupplier_getByid")
    @ResponseBody
    public ResponseResult DzmHisSupplier_getByid(Integer sid) {
        System.out.println("数据修改的id??????>>" + sid);
        DzmHisSupplier count = dzmHisSupplierService.DzmHisSupplier_getByid(sid);
        return new ResponseResult(200, "ok", count);
    }


    // =================purchase 采购信息表

    @RequestMapping("/DzmHisPurchase_list")
    @ResponseBody
    public ResponseResult dzmHisPurchase_list(DzmHisPurchase dzmHisPurchase) {
        System.out.println("采购信息！！列表↓↓↓↓↓↓↓");
        List<DzmHisPurchase> list = dzmHisPurchaseService.dzmHisPurchase_list(dzmHisPurchase);
        return new ResponseResult(200, "ok", list);
    }

    //  在采购里面的  insert 批量库存查询
    @RequestMapping("/DzmHisPurchase_batch_query")
    @ResponseBody
    public ResponseResult DzmHisPurchase_batch_query() {
        List<DzmHisBatchesOfInventory> list = dzmHisBatchesOfInventoryService.dzmHisPurchase_batch_query();
        return new ResponseResult(200, "ok", list);
    }

    @RequestMapping("/DzmHisPurchase_insert")
    @ResponseBody
    public ResponseResult DzmHisPurchase_insert(DzmHisPurchase dzmHisPurchase) {
        int insert = dzmHisPurchaseService.dzmHisPurchase_insert(dzmHisPurchase);
        System.out.println(">>>>>" + dzmHisPurchase);
        return new ResponseResult(200, "ok", insert);
    }


    @RequestMapping("/DzmHisPurchase_update")
    @ResponseBody
    public ResponseResult DzmHisPurchase_update(DzmHisPurchase dzmHisPurchase) {
        int update = dzmHisPurchaseService.dzmHisPurchase_update(dzmHisPurchase);
        System.out.println(">>>>>" + dzmHisPurchase);
        return new ResponseResult(200, "ok", update);
    }


    @RequestMapping("/DzmHisPurchase_update_getid")
    @ResponseBody
    public ResponseResult DzmHisPurchase_update_getid(Integer purchaseId) {
        System.out.println("数据修改的id??????>>" + purchaseId);
        DzmHisPurchase count = dzmHisPurchaseService.dzmHisPurchase_update_getid(purchaseId);
        return new ResponseResult(200, "ok", count);
    }

    @RequestMapping("/DzmHisPurchase_delete")
    @ResponseBody
    public ResponseResult dzmHisPurchase_delete(Integer purchaseId) {
        dzmHisPurchaseService.dzmHisPurchase_delete(purchaseId);
        return new ResponseResult(200, "ok");
    }


    //添加到审核表的insert
    @RequestMapping("/DzmHisBatchesOfInventory_insert")
    @ResponseBody
    public ResponseResult DzmHisBatchesOfInventory_insert(DzmHisBatchesOfInventory dzmHisBatchesOfInventory) {
        System.out.println("审核》》》》》》》》》》：："+dzmHisBatchesOfInventory);
        int insert = dzmHisBatchesOfInventoryService.dzmHisBatchesOfInventory_insert(dzmHisBatchesOfInventory);
        return new ResponseResult(200, "ok", insert);
    }


//  =============================audit==================审核表

//    public ResponseResult
//
    @RequestMapping("/dzmHisPurchase_review_the_drugs")
    @ResponseBody
    public ResponseResult dzmHisPurchase_review_the_drugs(DzmHisPurchase dzmHisPurchase) {
        List<DzmHisPurchase> list = dzmHisPurchaseService.dzmHisPurchase_review_the_drugs(dzmHisPurchase);
        return new ResponseResult(200, "ok", list);
    }


    @RequestMapping("/dzmHisPurchase_update_state")
    @ResponseBody
    public ResponseResult DzmHisPurchase_update_state(String batchesOfInventoryId) {
       int conut = dzmHisPurchaseService.dzmHisPurchase_update_state(batchesOfInventoryId);
        return new ResponseResult(200, "ok");
    }


    //=============================================================

    @RequestMapping("/dzmHisInventory_select")
    @ResponseBody
    public ResponseResult DzmHisInventory_select(DzmHisInventory dzmHisInventory) {
        List<DzmHisInventory> list = dzmHisInventoryService.dzmHisInventory_select(dzmHisInventory);
        return new ResponseResult(200, "ok", list);
    }

    @RequestMapping("/dzmHisInventory_update")
    @ResponseBody
    public ResponseResult DzmHisInventory_update(@RequestParam Map<String,String>map) {
         dzmHisInventoryService.dzmHisInventory_update(map);
        return new ResponseResult(200, "ok");
    }

    @RequestMapping("/dzmHisBatchesOfInventory_update_statu")
    @ResponseBody
    public ResponseResult DzmHisBatchesOfInventory_update_statu(String batchesOfInventoryId) {
        dzmHisBatchesOfInventoryService.DzmHisBatchesOfInventory_update_statu(batchesOfInventoryId);
        return new ResponseResult(200, "ok");
    }

    //不通过
    @RequestMapping("/dzmHisBatchesOfInventory_update_statu_btg")
    @ResponseBody
    public ResponseResult dzmHisBatchesOfInventory_update_statu_btg(String batchesOfInventoryId) {
        System.out.println(">>>>>>>>>>>>>>>>>>>>>"+batchesOfInventoryId);
        dzmHisBatchesOfInventoryService.dzmHisBatchesOfInventory_update_statu_btg(batchesOfInventoryId);
        return new ResponseResult(200, "ok");
    }

}


